/*
 * =====================================================================================
 *
 *       Filename:  word.c
 *
 *    Description:  AVL tree node content as word.
 *
 *        Version:  1.0
 *        Created:  2017/02/13 11:35:07
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Brook L. (), Brook_L@163.com
 *   Organization:  
 *
 * =====================================================================================
 */

#include <string.h>
#include <stdio.h>
#include "word.h"

/* 
 * <user: avl tree callback function, must be implemented by user>
 * compare between two words
 */
int wordCompare(Word *word1, Word *word2) {
    return strncmp(word1->word, word2->word, MAX_WORD_CHAR);
}

/* 
 * <user: avl tree callback function, must be implemented by user>
 * process when the word already exists during inserting
 */
void wordInsertMatchProcess(Word *word) {
    word->num++;
}

/* 
 * <user: avl tree callback function, must be implemented by user>
 * process when traverse the AVL tree
 */
void wordTravProcess (Word *word) {
    printf("    %s, %d\n", word->word, word->num);
}
